﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AnnieSharp
{
    public class Point : AObject
    {

        public Point(float x = 0, float y = 0)
        {
            _instanceType = "annie.Point";
        }

        /// <summary>
        /// 垂直坐标X
        /// </summary>
        public float X { get; set; } = 0;
        /// <summary>
        /// 垂直坐标Y
        /// </summary>
        public float Y { get; set; } = 0;

        /// <summary>
        /// 求两点间的距离
        /// </summary>
        /// <param name="point1">点1</param>
        /// <param name="point2">点2</param>
        /// <returns></returns>
        public static double Distance(Point point1, Point point2)
        {
            return Math.Sqrt((point1.X - point2.X) * (point1.X - point2.X) + (point1.Y - point2.Y) * (point1.Y - point2.Y));
        }
        /// <summary>
        /// 求两点间的距离
        /// </summary>
        /// <param name="point1x">点1</param>
        /// <param name="point1y">点2</param>
        /// <param name="point2x">点3</param>
        /// <param name="point2y">点4</param>
        /// <returns></returns>
        public static double Distance(float point1x,float point1y, float point2x,float point2y)
        {
            return Math.Sqrt((point1x - point2x) * (point1x - point2x) + (point1y - point2y) * (point1y - point2y));
        }

    }
}
